<script setup lang="ts">

import { ref } from 'vue';

type Todo = {
  id: number
  title: string
  finished: boolean
}

// 1.ref函数加类型
const todoList = ref<Todo[]>([
  { id: 1, title: '敲代码', finished: true },
  { id: 2, title: '看新闻', finished: false },
  { id: 3, title: '打羽毛球', finished: true }
])

</script>

<template>
  <div>
    <ul>
      <li v-for="item in todoList" :key="item.id">
        序号:{{ item.id }},任务:{{ item.title }},完成情况:{{ item.finished ? '已完成' : '未完成' }}
      </li>
    </ul>
  </div>
</template>

<style scoped></style>
